class Solution {
public:
    int numberOfBoomerangs(vector<vector<int>>& points) {
        int ret = 0;
        for(auto& kv : points){
            unordered_map<int,int> hash;
            for(auto& vc : points){
                int x = kv[0] - vc[0];
                int y = kv[1] - vc[1];
                int len = x * x + y * y;
                hash[len]++;
            }
            for(auto& [l,num] : hash){
                ret += num * (num - 1);
            }
        }
        return ret;
    }
};
